<?php

add_action('init', 'citations_register');
add_action('init', 'subjects_register');
add_action('admin_init', 'admin_init_citations');
add_action('save_post', 'citation_save');

function citations_register() {
    $labels = array(
        'name' => _x('Citations', 'post type general name'),
        'singular_name' => _x('Citation', 'post type singular name'),
        'add_new' => _x('Add New', 'portfolio item'),
        'add_new_item' => __('Add New Citation'),
        'edit_item' => __('Edit Citation'),
        'new_item' => __('New Citation'),
        'view_item' => __('View Citation'),
        'search_items' => __('Search Citations'),
        'not_found' => __('No citations found'),
        'not_found_in_trash' => __('No citations found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => null,
        'supports' => array('title','editor','thumbnail')
    );

    register_post_type('citations', $args);

}

function subjects_register() {
    register_taxonomy("Subjects", array("citations"), array("hierarchical" => true, "label" => "Subjects", "singular_label" => "Subject", "rewrite" => true, "show_ui" => true));
}

function admin_init_citations() {
    add_meta_box("citation_author-meta", "Author", "citation_author", "citations", "side", "low");
//    add_meta_box("citation_source-meta", "Source", "citation_source", "citations", "side", "low");
//    add_meta_box("citation_url-meta", "URL", "citation_url", "citations", "side", "low");
}

function citation_author() {
    global $post;

    $custom = get_post_custom($post->ID);
    $author = $custom["author"][0];
    ?>
    <label>Author</label>
    <input name="author" value="<?php echo $author; ?>" />
<?php
}

function citation_save() {
    global $post;

    update_post_meta($post->ID, "author", $_POST["author"]);
}
?>